package com.joe.learn.jvm;

import java.io.File;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class JobE {


    public static void main(String[] args) {

        long start = System.currentTimeMillis();
        BlockingQueue workQueue = new ArrayBlockingQueue<Runnable>(10);
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(30, 1000, 1000, TimeUnit.SECONDS, workQueue);
        final File file = new File("d:/jobE.txt");
        for (int i = 1; i <= 500; i++) {
            JobTask task = new JobETask(file);
            poolExecutor.execute(task);
        }
        poolExecutor.shutdown();
        System.out.println("JobE Time:" + (System.currentTimeMillis() - start));

    }

}
